package org.example;

import lombok.Builder;
import lombok.Data;

import javax.validation.GroupSequence;
import javax.validation.constraints.NotEmpty;
import javax.validation.groups.Default;

@Data
@Builder(toBuilder = true)
public class User {

    @NotEmpty(message = "firstName may be empty")
    private String firstName;
    @NotEmpty(message = "middleName may be empty", groups = Default.class)
    private String middleName;
    @NotEmpty(message = "lastName may be empty", groups = GroupA.class)
    private String lastName;
    @NotEmpty(message = "country may be empty", groups = GroupB.class)
    private String country;


    public interface GroupA {
    }

    public interface GroupB {
    }

    // 组序列
    @GroupSequence({Default.class, GroupA.class, GroupB.class})
    public interface Group {
    }
}